package com.wangzh.network.tcp.threadpool;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Server {
    public static void main(String[] args) throws IOException {

        ThreadPoolExecutor tp = new ThreadPoolExecutor(3,10,10, TimeUnit.SECONDS,new ArrayBlockingQueue<>(10));
        ServerSocket ss = new ServerSocket(10000);

        while (true){
            //等待客户端连接
            Socket socket = ss.accept();
            tp.submit(new MyRunnable(socket));

        }
    }
}
